package com.matrix.kernel.impl.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.matrix.kernel.core.dao.ModuleDao;
import com.matrix.kernel.core.model.module.Module;
import com.matrix.kernel.core.service.ModuleService;
import com.matrix.kernel.util.PageUtils;
import com.matrix.kernel.util.Query;

@Service
public class ModuleServiceImpl implements ModuleService{

	@Autowired
	ModuleDao moduleDao;
	
	/**
	 * 
	 * 获取程序的元数据
	 * 
	 */
	@Override
	@Transactional
	public PageUtils getModules(Map<String, Object> map) {
		Query query = new Query(map);
		List<Module> moduleList = moduleDao.queryList(query);
		int total = moduleDao.queryTotal(query);
		PageUtils pageUtils = new PageUtils(moduleList, total, query.getLimit(), query.getPage());
				
		return pageUtils;
	}

}
